const path = require('path'); //引入path模块
function resolve(dir) {
	return path.join(__dirname, dir) //path.join(__dirname)设置绝对路径
}
module.exports = {

	baseUrl: process.env.NODE_ENV === 'production' ?
		'/' :
		'/',
	configureWebpack: (config) => {
		config.resolve.alias = {
			'vue$': 'vue/dist/vue.js',
			'@': resolve('./src')
		};

		config.module.rules.push({
			test: /\.md$/,
			loaders: [
				'vue-loader',
				{
					loader: 'vue-md-loader',
					options: {
						preProcess(source) {
							// console.log('pre', source)
							return source
						},
						afterProcess(result) {
							// console.log('after', result)
							return result
						},
						afterProcessLiveTemplate(template) {
							return `<div class="live-wrapper">${template}</div>`
						},
						rules: {
							'table_open': () =>
								'<div class="table-responsive"><table class="table">',
							'table_close': () => '</table></div>'
						}
					}
				}
			]
		})
	}

}
